<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>ioko-tapestry-commons - </title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
                                                    
<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
                                                        
<script type="text/javascript">try {
                var pageTracker = _gat._getTracker("UA-75598-9");
                pageTracker._trackPageview();
                } catch(err) {}</script>
                    </head>
  <body class="composite">
    <div id="banner">
                  <a href="http://tapestry.formos.com/projects/ioko-tapestry-commons/" id="bannerLeft">
    
                                            <img src="images/tapestry-commons.png" alt="" />
    
            </a>
                        <a href="http://www.ioko.com/" id="bannerRight">
    
                                            <img src="images/ioko.png" alt="" />
    
            </a>
            <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
            
  
    
            <div class="xleft">
        Last Published: 2009-09-24
                      </div>
            <div class="xright">      
  

  
    
            
  
    
             Version: 1.6.0-SNAPSHOT
      </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
            
  
    
                   <h5>Sites</h5>
            <ul>
              
    <li class="none">
                    <a href="http://tapestry.formos.com/projects/ioko-tapestry-commons/" class="externalLink">Release Site</a>
          </li>
              
    <li class="none">
                    <a href="http://tapestry.formos.com/nightly/ioko-tapestry-commons/" class="externalLink">Nightly Site</a>
          </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
      
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
                        <h5>Developers</h5>
            <ul>
              
    <li class="none">
                    <a href="development.html">Development Guide</a>
          </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
            
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>Introduction</h2>
<p>This component provides caching of the generated HTML for a page snippet in EHCache. This is mainly useful if you have expensive (to render) areas of a page that you cannot fully cache (e.g. if the page is personalised).</p>
<p>Using ehcache as the cache backed gives you many options for configuration and management (e.g. you can use JMX to flush the caches).</p>
</div>
<div class="section"><h2>Usage</h2>
<p>'Simply' place the caching tag around your cachable content.</p>
<div class="source"><pre>&lt;dl id=&quot;cached&quot; t:type=&quot;ioko/Cache&quot;&gt;
    &lt;dt&gt;Time in cache&lt;/dt&gt;
    &lt;dd&gt;${now}&lt;/dd&gt;
&lt;/dl&gt;</pre>
</div>
<p>This will cache the content according for a 'medium' length of time.</p>
<p>You can specify short, medium or long cache times via the cacheRegion parameter</p>
<p>If your component renders different content depending on context you need to specify a cacheSuffix parameter to differentiate them.</p>
<div class="source"><pre> &lt;dl id=&quot;personallyCached&quot; t:type=&quot;ioko/Cache&quot; cacheSuffix=&quot;username&quot;&gt;
    &lt;dt&gt;Hi ${username} Time in cache&lt;/dt&gt;
    &lt;dd&gt;${now}&lt;/dd&gt;
 &lt;/dl&gt;</pre>
</div>
</div>
<div class="section"><h2>Configuration</h2>
<p>You don't need to configure the cache, but if you want to you simply create a '<a href="./ehcacheTapestryContext.xml">ehcacheTapestryContent.xml</a> and set the cache regions to cache as you want. This is a standard <a class="externalLink" href="http://ehcache.sourceforge.net/">EHCache</a> configuration file.</p>
<p>The components requires cache's called</p>
<ul><li>content-short</li>
<li>content-medium</li>
<li>content-long</li>
</ul>
</div>
<div class="section"><h2>Notes</h2>
<p>You must make sure you application server is NOT generating 'cookieless sessions' if your cached area includes any hyperlinks.</p>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2009
    
          ioko
          
  

  
    
            
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
